﻿@model BetterTaskList.Models.Ticket

@using (Html.BeginForm()) {

    @Html.ValidationSummary(true)

    <div id="content">
        
        <div>
            <div style="float:left; padding-top:6px; font-size:11px; text-align:right;">Subject:</div>
            <div style="float:left; padding-bottom:6px;">@Html.TextBoxFor(m => Model.TicketSubject, new { @style = "width:599px; height:26px;" })</div>
        </div>
    
        <div>
           <div style="float:left; padding-top:6px; font-size:11px; text-align:right;">To:</div>
           <div style="float:left; padding-bottom:6px;">@Html.TextBoxFor(m => Model.TicketOwnersEmailList, new { @style = "width:599px; height:26px;" })</div>
        </div>

       <div id="tabs" style="float:left; width:594px;">
	        <ul>
                <li><a href="#tabs-1">Body</a></li>
		        <li><a href="#tabs-2">Attachments</a></li>
	        </ul>
	        <div id="tabs-1">
                     @Html.TextAreaFor(m => Model.TicketDescription)
	        </div>
            
            <div id="tabs-2">
                    <div style="width:558px; font-size:12px;">
                      @Html.Partial("_FileUploader")
                    </div>
	        </div>
       </div>

        <div id="ticketCc">
                 <div style="float:left; padding-top:6px; font-size:11px; text-align:right;">Cc:</div>
                 <div style="float:left; padding-bottom:6px;">@Html.TextBoxFor(m => Model.TicketEmailNotificationList, new { @style = "width:599px; height:26px;" })</div>
        </div>

        <div class="clear"></div>

        <div style="padding-bottom:6px; padding-bottom:20px;">
            
            <div style="float:left;">
               @Html.Partial("_TicketPriority", Model)
            </div>
            
            <div style="text-align:right;padding-right: 4px;">
                @Html.Partial("_TicketDueDate")
            </div>

        </div>

        <div class="clear"></div>

        <div style="text-align:right;">
            <input id="save" type="submit" value="Save" /> or
            
            @if (Model.TicketStatus == "DRAFT")
            {
                @Html.ActionLink("Discard", "Discard", new { id=Model.TicketId, returnUrl = @Request.UrlReferrer }, null)
            }
            else
            {
                <a href="@Request.UrlReferrer">Cancel</a>
            }

        </div>

    </div>
}

    <div id="sidebar" class="sidebar widget-area" >
    @Html.Partial("_TicketAttachments")
    </div>  
    

<script src="@Url.Content("~/Scripts/jquery.autocomplete.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/jquery.autocomplete.css")" rel="stylesheet" type="text/css" />
	
<script type="text/javascript">
     $(function () {
     
         $("#tabs").tabs();

         $("#save").button();

         $("#check").button();

         $("#TicketDueDate").datepicker();

         // http://flux88.com/blog/jquery-auto-complete-text-box-with-asp-net-mvc/ 
         $("#TicketEmailNotificationList").autocomplete('../MembersEmailList', { multiple: true, mustMatch: false, multipleSeparator: ";", autoFill: true });

         $("#TicketOwnersEmailList").autocomplete('../MembersEmailList', { multiple: true, mustMatch: true, multipleSeparator: ";", autoFill: true });


     });
</script>   


<script src="@Url.Content("~/Scripts/tiny_mce/tiny_mce.js")" type="text/javascript"></script>
<script type="text/javascript">
    tinyMCE.init({
        mode: "textareas",
        width: "558",
        height: "250",
        theme: "advanced",
        theme_advanced_buttons1: "mymenubutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,undo,redo,link,unlink",
        theme_advanced_buttons2: "",
        theme_advanced_buttons3: "",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom"

    });
</script>
